#ifndef __GM_ENTITY_H__
#define __GM_ENTITY_H__

class CEntityManager;
class CEntity
{
public:
	CEntity() ;
	~CEntity();

	virtual INT Enter() ;
	virtual INT Execute();
	virtual INT Out() ;
	virtual void Del() ;

	void SetManager(CEntityManager* pManager);

protected:
	INT SetPrev(CEntity* pEntity);
	INT SetNext(CEntity* pEntity);
	CEntity* GetPrev();
	CEntity* GetNext();
protected:
	CEntity* m_pPrev;
	CEntity* m_pNext;
	CEntityManager* m_pManager;
	friend class CEntityManager ;
};


class CEntityManager
{
public:
	CEntityManager();
	~CEntityManager();

	void Insert(CEntity* pEntity);
	void Remove(CEntity* pEntity);
	void RemoveAll();
	void Update();
	void DelAll();
	void Exit();
	
	BOOL Find(CEntity* pEntity);
private:
	CEntity	m_Head;
	CEntity	m_Tail;
	INT 		m_iEntityNum;
};







#endif


